package com.lazybones.base.engineer.controller;

import com.lazybones.base.engineer.common.conf.minio.MinioConfig;
import com.lazybones.base.engineer.service.test.ITestService;
import com.lazybones.base.engineer.utils.snow.SnowflakeIdWorker;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/google")
public class TestGoogleController {
    private final ITestService iTestService;
    private final SnowflakeIdWorker snowflakeIdWorker;
    private final MinioConfig minioConfig;

    public TestGoogleController(ITestService iTestService, SnowflakeIdWorker snowflakeIdWorker, MinioConfig minioConfig) {
        this.iTestService = iTestService;
        this.snowflakeIdWorker = snowflakeIdWorker;
        this.minioConfig = minioConfig;
    }

    @RequestMapping(value = "/test",method = RequestMethod.GET)
    public String getQrcode(@RequestParam("id") int id, HttpServletResponse response){
         iTestService.selectById(id);
        System.out.println(response);
        //snowflakeIdWorker.nextId();
        //iTestService.selectByOther(id);
        String bucketName = minioConfig.getBucketName();
        System.out.println(bucketName);
        for (int i = 0; i < 1000; i++) {
           snowflakeIdWorker.nextId();
        }
        return  null;
    }

}
